package com.urbane.generator.model.dto;

import com.baomidou.mybatisplus.generator.config.OutputFile;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Map;

@Data
@Accessors(chain = true)
@Schema(description = "代码生成请求参数")
public class GenPackageRequest {
    /**
     * 生成代码的包名
     * <p>
     * 示例: com.example.project
     */
    @NotBlank(message = "包名不能为空")
    @Pattern(
            regexp = "^[a-zA-Z][a-zA-Z0-9_]*(\\.[a-zA-Z][a-zA-Z0-9_]*)*$",
            message = "包名格式不正确，应为有效的Java包名格式"
    )
    @Schema(
            description = "生成代码的包名",
            example = "com.example.project",
            requiredMode = Schema.RequiredMode.REQUIRED
    )
    private String parent;

    /**
     * 模块名称
     * <p>
     * 用于组织生成的代码结构
     */
    @NotBlank(message = "模块名称不能为空")
    @Schema(
            description = "模块名称",
            example = "user",
            requiredMode = Schema.RequiredMode.REQUIRED
    )
    private String moduleName;

    private String entity;
    private String service;
    private String serviceImpl;
    private String mapper;
    private String xml;
    private String controller;
    private Map<OutputFile, String> pathInfo;
    private final Map<String, String> packageInfo;
}
